<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
     function Star(uname,age){
       this.uname = uname
       this.age = age
    //    this.sing = function(){
    //     console.log('只应你太美')
    //    }
     }
    Star.prototype.sing = function(){
        this.sing = function(){
         console.log('只应你太美')
       }
    }

     const cxk = new Star('ikun',23)
     const cxk2 = new Star('ikun2',25)
     //console.log(cxk.sing === cxk2.sing) // false

     // 所以要挂在原型上
    // console.log(cxk.sing === cxk2.sing)  //true
     console.log(cxk.__proto__ === Star.prototype) //true 实例对象的__proto__指向构造函数的原型对象
     console.log(Star.prototype.constructor === Star)  //true 构造函数的原型对象指向构造函数
     console.log(cxk.constructor === Star) // true 是通过构造函数的原型对象身上的constructor属性指到构造函数的


     console.log(cxk.__proto__.__proto__ === Object.prototype) 
     console.log(cxk.__proto__.__proto__.constructor) // Object构造函数
     console.log(cxk.__proto__.__proto__.__proto__) // null
    </script>
</body>
</html>